package ui.uea;

import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.JTextField;

public class ModelPanel extends JPanel{
	private UEAPicturePath path = new UEAPicturePath();
	private JTextField modelNameField;
	private JTextField headCreditField;
	private JTextField tailCreditField;
	private JLabel addSubModelLabel;
	private JTable subModelTable;
	
	public ModelPanel(){
		this.setLayout(null);
		
		initModelNameField();
		this.add(modelNameField);
		
		initHeadCreditField();
		this.add(headCreditField);
		
		initTailCriditField();
		this.add(tailCreditField);
		
		initSubModelTable();
		this.add(subModelTable);
		
	}
	public void clearAll(){
		modelNameField.setText("");
		headCreditField.setText("");
		tailCreditField.setToolTipText("");
	}
	private void initModelNameField(){
		  modelNameField = new JTextField("name");

	}
	private void initHeadCreditField(){
		  headCreditField = new JTextField("name");; 

	}
	private void initTailCriditField(){
			tailCreditField= new JTextField("name");;


	}
	private void initSubModelTable(){
		  subModelTable= new JTable();
	}
	private void initAddSubModelLabel(){
		  addSubModelLabel= new JLabel("name");;
	}
	@Override 
	protected void paintComponent(Graphics g){
		super.paintComponent(g);
		BufferedImage im = null;
		try {
			 im = ImageIO.read(new File(path.getAddModel()));
		} catch (IOException e) {
			e.printStackTrace();
		}
		g.drawImage(im, 0, 0,this.getWidth(),this.getHeight(), null);
	}
}
